package io.renren.modules.subject.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.Query;
import io.renren.modules.meta.entity.EventEntity;
import io.renren.modules.subject.dao.PenaltyPersonsDao;
import io.renren.modules.subject.entity.PenaltyPersons;
import io.renren.modules.subject.service.PenaltyPersonsService;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;


@Service("penaltyPersonsService")
public class PenaltyPersonsServiceImpl extends ServiceImpl<PenaltyPersonsDao, PenaltyPersons> implements PenaltyPersonsService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<PenaltyPersons> page = this.page(
                new Query<PenaltyPersons>().getPage(params),
                new QueryWrapper<PenaltyPersons>()
        );

        return new PageUtils(page);
    }

    @Override
    public List<EventEntity> selectEventsBySubjectId(Long subjectId) {
        return baseMapper.selectEventsBySubjectId(subjectId,"tb_penalty_persons_event");
    }

    @Override
    public int insertSubjectEvent(Long subjectId, Long enventId) {
        return baseMapper.insertSubjectEvent(subjectId,enventId,"tb_penalty_persons_event");
    }

}